package com.stockz.ui.swing.watchlist.widget;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JMenuItem;
import javax.swing.JPanel;

import com.stockz.ui.swing.widget.JButton;
import com.stockz.ui.swing.widget.JTextField;

public class CreateNewWatchListMenuItem extends JMenuItem {
	private static final long serialVersionUID = 8254109731721915674L;

	private final JTextField nameTextField = new JTextField();
	private final JButton createButton = new JButton("Create");
	private final CreateNewWatchListActionListener actionListener;
	
	public CreateNewWatchListMenuItem(AddToWatchListMenu parent) {
		JPanel panel = new JPanel();
		nameTextField.setColumns(15);
		panel.add(nameTextField,BorderLayout.CENTER);
		panel.add(createButton,BorderLayout.EAST);
		actionListener = new CreateNewWatchListActionListener(nameTextField, parent);
		createButton.addActionListener(actionListener);
		nameTextField.addKeyListener(actionListener);
		add(panel, BorderLayout.CENTER);
		
		setPreferredSize(new Dimension(250,40));
	}
	

	
}
